<!--
 * @Descripttion: 
 * @Author: Wang Dejiang(aei)
 * @Date: 2022-07-24 21:02:40
 * @LastEditors: Wang Dejiang(aei)
 * @LastEditTime: 2022-07-24 22:03:17
-->
<!--
  Ryker's Test
-->
<template>
  <div style="display: flex; justify-content: center">
    <div id="main"></div>
    <div id="test1" style="height: 400px; width: 600px"></div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  mounted() {
    this.$monitor(this.$el)
    const chartDom = document.getElementById('main')
    const myChart1 = this.$echarts.init(chartDom, 'westeros')
    let option1 = {
      title: {
        text: '左上角标题'
      },
      tooltip: {},
      legend: {
        // 这里的data与series里的name联动
        data: ['代表数值']
      },
      xAxis: {
        // x轴数字和data联动
        data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子', '帅哥']
      },
      yAxis: {},
      series: [
        {
          name: '代表数值',
          type: 'bar',
          data: [5, 20, 36, 10, 10, 20, 1]
        }
      ]
    }

    // 使用刚指定的配置项和数据显示图表。
    myChart1.setOption(option1)

    const chart1Dom = document.getElementById('test1')
    const myChart2 = this.$echarts.init(chart1Dom, 'westeros')
    let option2 = {
      title: {
        text: 'Referer of a Website',
        subtext: 'Fake Data',
        left: 'center'
      },
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'left'
      },
      series: [
        {
          name: 'Access From',
          type: 'pie',
          radius: '50%',
          data: [
            { value: 1048, name: 'Search Engine' },
            { value: 735, name: 'Direct' },
            { value: 580, name: 'Email' },
            { value: 484, name: 'Union Ads' },
            { value: 300, name: 'Video Ads' }
          ],
          emphasis: {
            itemStyle: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
          }
        }
      ]
    }
    myChart2.setOption(option2)
  },
  methods: {}
}
</script>

<style scoped>
#main {
  height: 500px;
  width: 500px;
}
</style>
